//
//  BaseTableViewController.swift
//  bo
//
//  Created by 肖全刚 on 16/4/27.
//  Copyright © 2016年 肖全刚. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController {

    
    var login:Bool = false
    var  visitorView:VisitorView?
    override func loadView() {
        
        login ? super.loadView() : setupVistiorView()

        
    }
    
    /**
     初始化未登录页面
     */
    private func setupVistiorView()
    {
        visitorView = VisitorView()
        view = visitorView
        
        
        //监听登录点击
        visitorView?.registerButton.addTarget(self, action:Selector("registerBtnClick") , forControlEvents: UIControlEvents.TouchUpInside)
        
        visitorView?.loginButton.addTarget(self, action:Selector("loginBtnClick"), forControlEvents: UIControlEvents.TouchUpInside)
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: Selector("loginBtnClick"))
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: Selector("registerBtnClick"))
    }
    
    
    
    // MARK - 按钮点击
    func registerBtnClick()
    {
        XQGLog("注册")
    }
    
    func loginBtnClick()
    {
        XQGLog("登录")
    }
    
    
}
